package string;

public class Test {
    public static void main(String[] args) {
        String s1 = "www.tedu.cn";
        String s2 = "www.tarena.com.cn";
        String s3 = "doc.codeboy.com";
        String name1 = getHostName(s1);
        String name2 = getHostName(s2);
        String name3 = getHostName(s3);
        System.out.println(name1);
        System.out.println(name2);
        System.out.println(name3);
    }
    public static String getHostName(String url){
        int n1 = url.indexOf(".") + 1;
        int n2 = url.indexOf(".",n1);
        String n3 = url.substring(n1,n2);
        return n3;

    }
}
